package com.juc.singleton;

/**
 * @author hh
 * @since 2023/5/31
 */
public class LazyMan {

    private LazyMan() {

    }

    private volatile static LazyMan lazyMan;

    // 双重检查锁，懒汉式单例
    public static LazyMan getInstance() {
        if (lazyMan == null) {
            synchronized (LazyMan.class) {
                if (lazyMan == null) {
                    lazyMan = new LazyMan();
                }
            }
        }
        return lazyMan;
    }

}
